package com.chapter01exercise.homework13;

/**
 * @Author 小闽
 * @Date 2024/8/21 10:05
 * @PackageName: com.chapter01exercise.homework13
 * @ClassName: Student
 * @Description: 学生类
 * @Version 1.0
 */
public class Student extends Person {

    private int stu_id;

    /**
     * 构造器
     * @param name
     * @param sex
     * @param age
     * @param stu_id
     */
    public Student(String name, char sex, int age, int stu_id) {
        super(name, sex, age);
        this.stu_id = stu_id;
    }

    public int getStu_id() {
        return stu_id;
    }

    public void setStu_id(int stu_id) {
        this.stu_id = stu_id;
    }
    /**
     * 学生学习的方法
     */
    public void study(){
        System.out.println("我承诺，我会好好学习");
    }
    /**
     * 重写父类的play()方法
     */
    @Override
    public String play() {
        return super.play() + "爱玩足球";
    }
    /**
     * 定义printInfo()方法
     */
    public void printInfo(){
        System.out.println(super.getInfo() + "\n" + "学号：" + "\t" + getStu_id());
        study();
        System.out.println(play());
    }

    @Override
    public String toString() {
        return "Student{" +
                "stu_id=" + stu_id +
                '}' + super.toString();
    }
}
